<template>
	<view class="complaint">
		<view class="label">投诉建议:</view>
		<textarea style="background-color: #f8f8f8;width: 99%;padding: 5px;" v-model="value" placeholder="请输入投诉建议"
			></textarea>
		<view class="buttonBox">
			<view class="button" @click="submit">提交</view>
		</view>
	</view>
</template>

<script>
	import mine from '@/api/mine.js'
	export default {
		data() {
			return {
				userName: '',
				value: ''
			}
		},
		onLoad(e) {
			this.userName = e.username
		},
		methods: {
			submit() {
				if (!this.value) {
					uni.showToast({
						title: '请填写投诉或建议',
						icon: 'none'
					});
				}
				const params = {
					text: this.value,
					userName : this.userName
				}
				mine.complaint(params).then(res => {
					if(res.code==200 ){
						uni.showToast({
							title: '提交成功',
							icon: 'none'
						});
						setTimeout(()=>{
							uni.navigateBack()
						},2000)
					}
				})
			}
		}
	}
</script>

<style scoped lang="less">
	.complaint {
		background-color: #fff;
		width: 100%;
		height: 100%;
		padding: 25rpx;
		font-size: 31rpx;

		.label {
			margin: 8px 0 14px 0;
			font-weight: 600;
			font-size: 33rpx;
		}

		.buttonBox {
			width: calc(100% - 50rpx);
			height: 100px;
			display: flex;
			justify-content: center;
			align-items: center;
			position: fixed;
			bottom: 0;

			.button {
				width: 93%;
				height: 80rpx;
				background-color: #325ef5;
				color: #fff;
				border-radius: 25px;
				display: flex;
				justify-content: center;
				align-items: center;
			}
		}
	}
</style>